package com.smbms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.smbms.entity.SmbmsBill;
import com.smbms.entity.page.Page;
import com.smbms.mapper.SmbmsBillMapper;
import com.smbms.service.BillService;

@Transactional
@Service
public class BillServiceImpl implements BillService {

	@Autowired
	SmbmsBillMapper billMapper;

	public Page<SmbmsBill> selectByPage(String queryProductName, Integer queryProviderId, Integer queryIsPayment,
			Integer pageNo) {
		
		Page<SmbmsBill> pageInfo = new Page<SmbmsBill>(pageNo,2);
		
		pageInfo.setTotalRow(billMapper.selectByPageCount(
				queryProductName,
				queryProviderId,
				queryIsPayment));
		pageInfo.setList(billMapper.selectByPage(
				queryProductName,
				queryProviderId,
				queryIsPayment,
				(pageNo - 1 ) * pageInfo.getPageSize(),
				pageInfo.getPageSize()));
		return pageInfo;
	}
}
